Motion estimation technique for digital video encoding applications

ABSTRACT

The present invention provides an improved motion estimation encoder for digital video encoding applications. In one example embodiment, the improved encoder receives a raw image in the form of a current frame and estimates the macroblock motion vector with respect to a reference frame. The encoder then performs an initial local search around an initial motion vector candidate derived from spatio-temporal neighboring macroblock parameters. The encoder then compares the user-defined complexity scalable sum of absolute difference between the original and the associated reference macroblock against an adaptive threshold value for motion estimation convergence. The encoder introduces a global full search around a candidate from a coarser level, in case an initial local search fails. The encoder then selects an inter encoding mode for coding the current macroblock, when the first local search is successful, otherwise the encoder selects the inter or intra encoding mode for encoding the current macroblock by comparing variances of the original and difference macroblocks.

PRIORITY INFORMATION

This application is a Divisional of U.S. application Ser. No.12/732,049, filed on Mar. 25, 2010 and issued on Apr. 16, 2013 as U.S.Pat. No. 8,422,558, which is a Divisional of U.S. application Ser. No.10/202,236, filed on Jul. 24, 2002, which claims priority to U.S.Provisional Application No. 60/307,539, filed on Jul. 24, 2001, whichapplications are incorporated herein by reference in their entirety.

FIELD OF THE INVENTION

This invention generally relates to digital video encoding techniques,and more particularly to motion estimation techniques for digital videoencoding applications.

BACKGROUND

In recent years, it has become increasingly desirable and practical tocommunicate digital video information—sequence of digital images—fromone point to another. Indeed, transmission of video over computernetworks, such as the World-Wide-Web portion of the Internet, from onecomputer to another is uncommon in digital television set-top boxes,DSS, HDTV decoders, DVD Players, Video Conferencing, Internet Video andother such applications. Since a single frame of video can consist ofthousands or even hundreds of thousands of bits of information, it cantake a considerable amount of time to transmit a sequence of frames fromone point to another.

To reduce transmission costs, computers and other devices that transmitand receive digital video data generally include a video compressionsystem. The video compression system typically includes an encoder forcompressing digital video data from its raw form and a correspondingdecoder at the receiver end for decompressing the compressed frame.

Video compression typically takes advantage of the redundancy within andbetween sequential frames of video data to reduce the amount of dataultimately needed to represent the sequence. The DPCM/DCT (DifferentialPulse-Coded Modulation/Discrete Cosine Transform) hybrid codingtechnique has proved to be the most effective and successful for videocompression. All current international standards, namely ITU H.261 andH.263, ISO MPEG I and II, have adopted this coding structure. In ahybrid video coder, prediction coding is used to reduce the temporalredundancy, and DCT is applied to the prediction error signal toeliminate the remaining spatial redundancy.

Motion estimation can be classified into two categories, namely theblock-matching and pel-recursive (See H. G. Musmann, P. Hirsch, and H.J. Grallert, “Advances in picture coding,” Proc. IEEE, pp. 523-548,April 1985, and M. Orchard, “A comparison of techniques for estimatingblock motion in image sequence coding,” Proc. SPIE Visual Commun. andImage Processing, pp. 248-258, 1989). Because hybrid video coders areblock-based and block-matching methods need much less complexity thanpel-recursive to implement, only block matching has been considered forcurrent practical video compression systems.

In hybrid coding, a video frame to be encoded is partitioned intonon-overlapping rectangular, or most commonly, square blocks of pixels.The DCT domain operations are based on block sizes of 8×8 pixels. Motioncompensation operates on macroblocks of 16×16 pixels. For each of thesemacroblocks, the best matching macroblock is searched from a referenceframe in a predetermined search window according to a predeterminedmatching error criterion. Then the matched macroblock is used to predictthe current macroblock, and the prediction error macroblock is furtherprocessed and transmitted to the decoder. The relative shifts in thehorizontal and vertical directions of the reference macroblock withrespect to the original macroblock are grouped and referred to as themotion vector of the original macroblock, which is also transmitted tothe decoder. The main aim of motion estimation is to predict amacroblock such that the difference macroblock obtained from taking adifference of the reference and current macroblocks produces the lowestnumber of bits in DCT encoding.

The most straightforward method to search for the motion vector is thebrute-force, global full-search (FS) method. In the FS method, allpossible candidate locations in the search window are used to find thebest match. Although this method can produce the best motion vectoraccording to predetermined matching criterion, it is usually too complexto implement for real-time applications at a reasonable cost. To thisend, various less complex methods have been proposed and studied toeither reduce the complexity of evaluating the match error at eachsearch location or to reduce the number of search locations, or both.

One of the most efficient current motion estimation techniques uses atwo-stage approach. In the first stage a local search is made around aprospective candidate (see Junavit Chalidabhongse, C. C. Jay Kuo, “FastMotion Vector Estimation using Multi-Resolution-Spatio-TemporalCorrelations,” IEEE Transaction on circuits and systems for videotechnology, Vol. 7, No 3, June 1997). The prospective candidate ischosen from the spatio-temporal neighborhood of the current macroblock(16×16 pixels). If the distortion measurement at any step is less than apredefined threshold, the corresponding motion vector is selected as themotion vector of the current macroblock. This local search method isallowed to operate for a predefined number of steps. If after all ofthese steps, no favorable motion vector is obtained, then an FS isexecuted with an origin around (0,0) motion vector. Unlike a localsearch, FS does not have any intermediate stopping criteria. It willcalculate distortion measurement for all motion vectors in the searcharea and select the motion vector corresponding to the lowestdistortion.

The problem with this approach is the selection of a reasonable fixedpre-defined threshold for stopping criteria during a local search forall macroblocks. If the selected predefined threshold is relativelyhigh, the motion estimation search process can stop prematurely,selecting a non-optimal motion vector. This can result in generating ahigher variance for the difference macroblock than the original and theencoder will be forced to do intra coding (Intra frames/blocks are codedwithout prediction information) for the current macroblock. This canlead to lower quality for Constant Bit Rate (CBR) encoding or it canresult in a lower compression ratio for the Variable Bit Rate (VBR), ifthe selected pre-defined threshold value is relatively low. The localsearch process may not be able to satisfy the stopping criteria throughan optimal or near optimal motion vector. This can again lead toselecting the motion vector through FS and this in turn can considerablyincrease search time. In reality, the threshold varies from onemacroblock to the other. Therefore, choosing a fixed threshold canaffect the quality of compression and encoder performance.

SUMMARY OF THE INVENTION

The present invention provides an improved motion estimation techniquefor digital video encoding applications. In one example embodiment, thisis accomplished by using a computationally efficient encoder to computeframe-to-frame macroblock based motion vectors of digital images. Theimproved encoder receives a raw image in the form of a current frame.The encoder then performs an initial local search around an initialmotion vector candidate derived from spatio-temporal neighboringmacroblock parameters. The encoder then compares the user-definedcomplexity scalable sum of absolute difference between the original andassociated reference macroblock against an adaptive threshold value formotion estimation convergence. In case an initial local search fails, asecond search is then performed around a candidate from a coarser levelby the encoder. The encoder then selects an inter encoding mode forcoding the current macroblock, when the first local search issuccessful. Otherwise the encoder selects the inter or intra encodingmode for encoding the current macroblock by comparing variances oforiginal and difference macroblocks.

Other aspects of the invention will be apparent on reading the followingdetailed description of the invention and viewing the drawings that forma part thereof.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram illustrating the major modules of the videoencoder structure of the present invention.

FIG. 2 is a flowchart illustrating the operation of the digital videocompression of the present invention.

FIG. 3 is a flowchart illustrating the operation of another embodimentof the present invention.

FIG. 4 is a block diagram of a suitable computing system environment forimplementing embodiments of the present invention, such as those shownin FIGS. 1, 2, and 3.

DETAILED DESCRIPTION

The present invention provides an efficient digital video compressiontechnique that enhances encoder performance without compromising thequality of the compression during motion estimation. Also, the techniqueenhances encoder performance without increasing the search time for amotion vector. In one embodiment, this is accomplished by providing acomputationally efficient processing technique to compute aframe-to-frame macroblock based motion vectors of digital images. Theimproved encoder receives a raw image in the form of a current frame.The encoder then performs an initial local search around an initialmotion vector candidate derived from spatio-temporal neighboringmacroblock parameters. The encoder then compares the user-definedcomplexity scalable sum of absolute difference between the original andthe associated reference macroblock against an adaptive threshold valuefor motion estimation convergence. If the initial local search fails,the encoder then introduces a global full search around a candidate froma coarser level. The encoder then selects inter mode encoding when thefirst local search is successful. Otherwise the encoder selects inter orintra encoding mode by comparing variances of the original and thedifference macroblock.

FIG. 1 is a block diagram illustrating major modules of the videoencoder structure 100 of the present invention. Shown in FIG. 1 are areceive module 110, an FDCT module 120 coupled to the receive module110, a quantizer 130 coupled to the FDCT module 120, a motion estimationmodule 140 coupled to the receive module 110, a reconstruction module150 coupled to the motion estimation module 140, a VLC encoder 170coupled to the quantizer 130, and an encoder controller 160 coupled tothe VLC encoder 170 and the reconstruction module 150. In addition,quantizer 130 is coupled to reconstruction module 150. The motionestimation module 140 further includes an analyzer 142, a comparator144, and a memory 146.

In operation, the receive module 110 receives raw images in the form ofcurrent frames in YUV format. Y stands for luminance and U and V (U, V)stand for chrominance. Receive module 110 also receives associatedencoding parameters and prediction information, such as intra or intercoding for coding the frames. Receive module 110 then makes correctionsusing the received prediction information to the received current framewhen encoded as an inter frame. Motion estimation module 140 is usedonly when the received current frame is coded as inter frame. Motionestimation is performed on macroblocks. In an intra frame, allmacroblocks are coded as intra, but in an inter frame, macroblocks maybe coded as intra and inter. The macroblock coding mode is selectedusing a motion estimation output.

When the receive module 110 receives a current frame to be coded as anintra frame, the FDCT (Forward Discrete Cosine Transformation) module120 transforms the current frame to frequency domain information. Insome embodiments, FDCT module 120 transforms the current frame tofrequency domain information by partitioning the received current frameinto blocks of 8×8 pixels and performs a discrete cosine transformationon all chrominance and luminance blocks of the current frame to form DCTcoefficients. The discrete cosine transformation (DCT) operation does aspatial-to-frequency transformation of the raw current frame to produceDCT coefficients for each block.

Quantizer 130 then quantizes the produced DCT coefficients in each blockusing a quantization parameter, calculated by rate, control along withquantization matrix given by the Video Encoder Standard. Thequantization operation reduces the dynamic range of the DCT coefficientsin each block. This operation generally includes dividing the DCTcoefficients by a quantizer value. During decoding, an inverse operationis performed (and also in the reconstruction module 150 of the encoder100) on the quantized DCT coefficients by multiplying the quantized DCTcoefficients with the same quantizer value used in dividing the DCTcoefficients during the encoding operation. Quantizer 130 then performsrounding operations on the quantized DCT coefficients.

In some embodiments, quantizer 130 divides the DCT coefficients in eachof the blocks by a quantization parameter to reduce the dynamic range ofthe transformed frequency domain information. Quantizer 130 then roundsof the quantized DCT coefficients.

VLC encoder 170 then codes the quantized DCT coefficients using standardspecified variable length codes. These codes are generally generatedusing huffman coding concepts. In huffman coding, the highest number ofbits is allocated to the rare combination and the smallest number ofbits are allocated to the most probable combination. Here ‘combination’means a symbol composed of the run and level of quantized DCTcoefficients of a block. The ‘level’ means the absolute value of thequantized DCT coefficient and the ‘run’ means the number of zeroelements present between the current non-zero quantized DCT coefficientand the previous non-zero coefficient traversed in a particular scanningorder. Generally, a signal is included at the end of each block toindicate the end of the block.

In some embodiments, VLC 170 encoder receives the quantized frequencydomain information of the current macroblock along with associatedmotion vector information and reduces the number of bits required torepresent the received information using a non-adaptive entropy codebook. The non-adaptive entropy code book includes a distribution ofleast number of bits for most probable cases and more number of bits forthe least probable cases. VLC encoder 170 further generates a variablelength code for motion vector for inter macroblock using a motion vectorcode table.

The encoder controller 160 then arranges the variable length coded DCTcoefficients in a particular way with an appropriate header as specifiedin the Standard. The encoder controller 160 then outputs a coded streamof images 180. In some embodiments, encoder controller 160 receives thereduced number of bits representing the current macroblock from the VLCencoder and adds packetization information and outputs an encodedcurrent frame.

Reconstruction module 150 receives quantized DCT coefficients fromquantizer 130 and reconstructs each block by inverse quantized QDCT(quantized DCT) coefficients and by inverse DCT transforming the inversequantized QDCT coefficients. The reconstructed DCT coefficients are thenused by receive module 110 for making corrections to the current frameencoded as an inter frame.

In some embodiments, reconstruction module 150 receives the quantisedcurrent frame and associated initial distortion and computes adifference frame. Reconstruction module 150 then computes a motioncompensation frame using the selected initial motion vector and aprevious reference frame and reconstructs the current frame by addingthe difference frame and the computed motion compensation frame.

When receive module 110 receives the current frame to be encoded as aninter frame, motion estimation module 140 performs motion estimationusing the current frame and a reconstructed reference frame. Thereconstructed reference frame is generally the reconstructed previousframe received from reconstruction module 150. Motion estimation is doneon blocks of 16×16 pixels, known as ‘macroblocks.’

During motion estimation, receive module 110 receives a raw image in theform of a current frame and its associated encoding parameters. Receivemodule 110 makes corrections by subtracting prediction information fromthe received current frame when encoded as an inter frame. In someembodiments, analyzer 142 searches a macroblock region in the referenceframe for the closest match to an associated macroblock region in thecurrent frame. Then FDCT module 120 receives the corrected currentmacroblock and transforms the current macroblock to frequency domaininformation. In some embodiments, frequency domain informationtransformation includes spatial-to-frequency transformation forcompression of image data. In some embodiments, FDCT module 120transforms the spatial domain information by partitioning the receivedcorrect current frame into blocks of 8×8 pixels and then performs DCTtransformation on each of the partitioned blocks to form DCTcoefficients. In some embodiments, DCT coefficients includespatial-to-frequency transformation information.

Then quantizer 130 reduces the dynamic range of the transformedfrequency domain information of the current frame by using aquantization value or parameter. In some embodiments, quantizer 130divides the DCT coefficients in each of the blocks by a quantizationvalue to reduce the transformed frequency domain information.

During motion estimation, analyzer 142 partitions the quantized currentframe into non-overlapping rectangular macroblocks. In addition,analyzer 142 computes a motion estimation termination threshold for acurrent macroblock in the current frame using the current macroblock'sparameters. Further, analyzer 142 selects an initial motion vector byusing spatio-temporal neighboring macroblock parameters. In someembodiments, analyzer 142 computes the motion vector by determining arelative position of the matched macroblock in the reference frame withrespect to the current macroblock. For example, if the motion vector is(0,0) (zero in both horizontal and vertical directions), then thematched macroblock is the co-located macroblock in reconstructedreference frame. Analyzer 142 then determines an initial distortion forthe current macroblock by computing a sum of absolute difference usingthe computed initial motion vector and an associated referencemacroblock.

Then comparator 144 compares the computed initial distortion to thecomputed motion estimation termination threshold. Then analyzer 142either terminates or continues the motion estimation process based onthe outcome of the comparison.

In some embodiments, analyzer 142 selects inter coding for encoding thecurrent macroblock when the computed initial distortion is less than thecomputed motion estimation termination threshold. In some embodiments,analyzer 142 computes the sum of absolute difference values at each ofthe equidistant motion vector positions from the initial motion vectorwhen the computed initial distortion is greater than or equal to thecomputed motion estimation termination threshold. In addition in thisembodiment, analyzer 142 determines a minimum sum of absolute differencevalue from the computed sum of absolute difference values. Then thecomparator 144 compares the determined minimum sum of absolutedifference value to the motion estimation termination threshold andselects an encoding mode based on the outcome of the comparison bycomparator 144.

In some embodiments, analyzer 142 selects an inter coding mode forencoding the current macroblock when the determined minimum sum ofabsolute difference value is less than the motion estimation terminationthreshold. In other embodiments, when the determined minimum sum ofabsolute difference value is greater than or equal to the motionestimation termination threshold, analyzer 142 repeats the computationof the sum of absolute difference values in the next levels ofequi-distant motion vectors for a predetermined number of times. Whenthe determined minimum sum of absolute difference value obtained afterrepeating the above search for the predetermined number of times doesnot yield a value less than the motion estimation termination threshold,analyzer 142 performs a global full search to encode the currentmacroblock.

Then VLC encoder 170 receives the quantized frequency domain informationof the current frame, along with associated motion vector information,and reduces the number of bits required to represent this informationusing a look-up table (non-adaptive entropy code book). This is based onusing the least number of bits for the most probable cases and a largernumber of bits for the least probable cases. Further, VLC encoder 170generates variable length code for the motion vector for intermacroblock using the look-up table. Reconstruction module 150 receivesquantized coefficients of each macroblock and associated motioncompensation information and generates a reconstructed current frame byadding a difference frame and a motion compensated frame. The differenceframe is computed using the quantized coefficients and motioncompensation information and further the motion compensated frame iscomputed using motion vector information and a previous reference frame.Encoder controller 160 then receives the reduced number of bitsrepresenting the current frame from VLC encoder 170 and addspacketization information, and outputs an encoded current frame. In someembodiments, memory 146 stores non-adaptive entropy codebook informationand any previously reconstructed frame information.

FIG. 2 is a flowchart illustrating one example embodiment of a process200 of frame-to-frame digital video encoding by estimating a motionvector of a digital image macroblock. The flowchart includes steps210-295, which are arranged serially in the exemplary embodiment.However, other embodiments of the invention may execute two or moresteps in parallel using multiple processors or a single processororganized as two or more virtual machines or subprocessors. Moreover,still other embodiments implement the steps as two or more specificinterconnected hardware modules with related control and data signalscommunicated between and through the modules, or as portions of anapplication-specific integrated circuit. Thus, the exemplary processflow is applicable to software, firmware, and hardware implementations.

The process begins with step 210 by partitioning a received currentframe into non-overlapping macroblocks. A single frame of video canconsist of thousands or even hundreds of thousands of bits of data.Macroblocks are based on square blocks including a luminance componentof 16×16 pixels in size. Each macroblock has associated two chrominanceblocks of 8×8 pixels in size. But motion estimation is done only on theluminance component. Motion vectors of chrominance components arederived from luminance motion vectors.

Step 220 includes computing a motion estimation termination thresholdfor the current macroblock using macroblock parameters. In someembodiments, the motion estimation termination threshold for the currentmacroblock is computed using the equation:

${sqrt}\left( {{\sum\limits_{I = 0}^{255}\left( {x_{I} - \mu} \right)^{2}} + {2*255*128*\left( x_{avg} \right)^{2}}} \right)$

wherein x_(I)'s are luminance components of the current macroblock,x_(avg) is the allowed average absolute pixel-difference for an optimalprediction, and μ is the mean of x_(I) where I=0 to 255.

Step 230 includes selecting an initial motion vector for the currentmacroblock using spatio-temporal macroblock parameters. In someembodiments, initial motion vector is selected by selecting candidatespatio-temporal neighboring macroblocks having computed motion vector.Then selecting the initial motion vector for the current macroblock fromthe selected candidate macroblocks based on a predetermined votingtechnique. Predetermined voting technique is based on initially gettinga value close to the associated reference macroblock.

Step 240 includes determining the initial distortion for the currentmacroblock by computing a sum of absolute difference, also referred toas an initial distortion measure, using the selected initial motionvector and associated reference macroblocks. In some embodiments, thesum of absolute difference between the current macroblock and theassociated reference macroblock is computed using the equation:

$\sum\limits_{I = 0}^{255}{{x_{I} - y_{I}}}$

wherein x_(I)'s are the luminance components of the current macroblockand y_(I)'s are luminance components of the reference macroblock.

Step 250 includes comparing the computed initial distortion to thecomputed motion estimation termination threshold. Step 255 then, encodesusing the inter coding mode and the selected initial motion vector ischosen as the representative motion vector for the current macroblock,when the computed initial distortion is less than the computed motionestimation termination threshold. Encoding using inter coding meansencoding the current macroblock by using the computed motion vectorinformation of the current macroblock, along with QDCT.

When the computed initial distortion is greater than or equal to thecomputed motion estimation termination threshold, step 260 includescomputing the sum of absolute difference values at each of theequidistant motion vector positions from the initial motion vector, andfurther includes determining a minimum sum of absolute difference valueusing the computed sum of absolute difference values. In someembodiments, if the initial motion vector is (u, v), then the sum ofabsolute difference values is computed for equidistant positions at{(u−1, v−1), (u−1, v), (u−1, v+1), (u, v−1), (u, v+1), (u+1, v−1), (u+1,v), (u+1, v+1)}.

Step 270 includes comparing the determined minimum sum of absolutedifference value to the computed motion estimation terminationthreshold. When the determined minimum sum of absolute difference valueis less than the motion estimation termination threshold, step 273encodes the current macroblock using the inter coding mode and themotion vector associated with the minimum sum of absolute difference ischosen as the representative motion vector.

When the determined minimum sum of absolute difference value from theprevious step is greater than or equal to the motion estimationtermination threshold, step 272 includes repeating the process describedin steps 260, 270, and 273 for a predetermined number of times usingnext levels of equi-distant motion vector values and the motion vectorassociated with the minimum sum of absolute difference as the initialmotion vector.

When after repeating the above-described steps for the predeterminednumber of times, the determined minimum sum of absolute difference doesnot yield a value less than the motion estimation termination threshold,step 280 includes computing the motion vector based on the minimum sumof absolute difference value through full search algorithm, and furtherincludes computing block variances of current and differencemacroblocks. In some embodiments, the block variance of current anddifference macro blocks are computed and compared using the followingequations:

${\sum\limits_{I = 0}^{255}\left( {x_{I} - y_{I}} \right)^{2}} < {\sum\limits_{I = 0}^{255}\left( {x_{I} - \mu} \right)^{2}}$

Step 290 includes comparing the computed variance of the currentmacroblock with the computed variance of the difference macroblock. Thecurrent macroblock is then encoded by selecting inter or intra mode asshown in steps 275 and 295 based on the outcome of the comparison. Ininter mode, the motion vector associated with the minimum sum ofabsolute difference from the global full search is chosen as therepresentative motion vector. Encoding using intra mode means encodingthe current macroblock without using the motion vector estimation.

FIG. 3 is a flowchart illustrating one example embodiment of a process300 of computing the sum of absolute difference between the current andreference macroblocks to reduce the complexity of the above-describedcomputationally intensive step 240. This is achieved by exploiting theknowledge of “average bit generation is proportional to variance.”During initial distortion calculation, i.e., the sum of absolutedifference calculation, a partial or full area of macroblocks are useddepending on the original macroblock's variance. The process ofcomputing the sum of absolute difference using the partial or full areaof macroblocks is explained in more detail below using flowchart 300.

Flowchart 300 includes steps 310-370, which are arranged serially in theexemplary embodiment. However, other embodiments of the invention mayexecute two or more steps in parallel using multiple processors or asingle processor organized as two or more virtual machines orsubprocessors. Moreover, still other embodiments implement the steps astwo or more specific interconnected hardware modules with relatedcontrol and data signals communicated between and through the modules,or as portions of an application-specific integrated circuit. Thus, theexemplary process flow is applicable to software, firmware, and hardwareimplementations.

The process begins with step 310 by computing first and second thresholdvalues. In some embodiments, the first and second threshold values arecomputed using the following equations:first threshold value=(α+motionspeedflag)²*256second threshold value=(β+motionspeedflag)²*256

wherein α and β are user-specified constants (α<β) and motionspeedflagis a user specified integer value that controls the computational speedof the encoder.

Step 320 includes calculating the variance of the current macroblocks.In some embodiments, the variance of the current macroblocks arecomputed using the equation:variance=S ₂−(S*S)/256

wherein S₂ is a sum of squares of all luminance components of themacroblock and S is a sum of all luminance components of the macroblock.

Step 330 includes comparing the computed variance of current macroblockswith the computed first threshold value. When the computed variance isless than or equal to the first threshold value, step 340 includescomputing the sum of absolute difference using a first fraction of thenumber of pixels in the current and reference macroblocks. The computedsum of absolute difference is then multiplied by a first scale factor toobtain the sum of absolute difference for all the pixels in themacroblocks. In some embodiments, the first fraction of the number ofpixels is 25% of the number of pixels in the current and referencemacroblocks. In these embodiments, the first scale factor used to obtainthe sum of absolute difference for all the pixels in the macroblocks is4.

When computed variance of current macroblock is already greater thanfirst threshold value, step 350 includes comparing the computed varianceof current macroblocks with the computed second threshold value. Whenthe computed variance is greater than or equal to the first thresholdvalue and further the computed variance is less than or equal to thesecond threshold value, step 360 includes computing the sum of absolutedifference using a second fraction of the number of pixels in thecurrent and reference macroblocks. The computed sum of absolutedifference is then multiplied by a second scale factor to obtain the sumof absolute difference for all the pixels in the macroblocks. In someembodiments, the second fraction of the number of pixels is 50% of thenumber of pixels in the current and reference macroblocks. In theseembodiments, the second scale factor used to obtain the sum of absolutedifference for all the pixels in the macroblocks is 2.

When the calculated variance of the current macroblocks is greater thanthe second threshold value, step 370 includes computing the sum ofabsolute difference using all of the pixels in the current and referencemacroblocks.

Methods 200 and 300 shown in FIGS. 2 and 3 may be implemented as areceive module 110, an analyzer 142, a comparator 144, a memory 146, areconstruction module 150, an encoder controller 160, and a VLC encoder170, as shown in FIG. 1. Various aspects of the present invention areimplemented in software, which may be run in the environment shown inFIG. 4 or any other suitable computing environment. The presentinvention is operable in a number of other general purpose or specialpurpose computing environments. Some computing environments are personalcomputers, general-purpose computers, server computers, hand-helddevices, laptop devices, multiprocessors, microprocessors, set topboxes, programmable consumer electronics, network PCs, minicomputers,mainframe computers, distributed computing environments and the like toexecute computer-executable instructions for performing a frame-to-framedigital video encoding of the present invention, which is stored on acomputer readable medium. The present invention may be implemented inpart or in whole as computer-executable instructions, such as programmodules that are executed by a computer. Generally, program modulesinclude routines, programs, objects, components, data structures and thelike to perform particular tasks or to implement particular abstractdata types. In a distributed computing environment, program modules maybe located in local or remote storage devices.

FIG. 4 shows an example of a suitable computing system environment 400for implementing embodiments of the present invention, such as thoseshown in FIGS. 1, 2, and 3. Various aspects of the present invention areimplemented in software, which may be run in the environment shown inFIG. 4 or any other suitable computing environment. The presentinvention is operable in a number of other general purpose or specialpurpose computing environments. Some computing environments are personalcomputers, server computers, hand-held devices, laptop devices,multiprocessors, microprocessors, set top boxes, programmable consumerelectronics, network PCs, minicomputers, mainframe computers,distributed computing environments, and the like. The present inventionmay be implemented in part or in whole as computer-executableinstructions, such as program modules that are executed by a computer.Generally, program modules include routines, programs, objects,components, data structures and the like to perform particular tasks orto implement particular abstract data types. In a distributed computingenvironment, program modules may be located in local or remote storagedevices.

FIG. 4 shows a general computing device in the form of a computer 410,which may include a processing unit 402, memory 404, removable storage412, and non-removable storage 414. The memory 404 may include volatile406 and non-volatile memory 408. Computer 410 may include—or have accessto a computing environment that includes—a variety of computer-readablemedia, such as volatile 406 and non-volatile memory 408, removable 412and non-removable storage 414. Computer storage includes RAM, ROM, EPROM& EEPROM, flash memory or other memory technologies, CD ROM, DigitalVersatile Disks (DVD) or other optical disk storage, magnetic cassettes,magnetic tape, magnetic disk storage or other magnetic storage devices,or any other medium capable of storing computer-readable instructions.Computer 410 may include or have access to a computing environment thatincludes input 416, output 418, and a communication connection 420. Thecomputer may operate in a networked environment using a communicationconnection to connect to one or more remote computers. The remotecomputer may include a personal computer, server, router, network PC, apeer device or other common network node, or the like. The communicationconnection may include a Local Area Network (LAN), a Wide Area Network(WAN) or other networks.

CONCLUSION

The above-described invention provides an efficient digital videocompression technique that enhances encoder performance withoutcompromising on the quality of compression during motion estimation.Further the technique provides an alternative approach to global fullsearch technique (FS) that can be implemented in real-time applicationsat a reasonable cost.

The above description is intended to be illustrative, and notrestrictive. Many other embodiments will be apparent to those skilled inthe art. The scope of the invention should therefore be determined bythe appended claims, along with the full scope of equivalents to whichsuch claims are entitled.

The invention claimed is:
 1. A computer system for performing aframe-to-frame digital video encoding, comprising: a processor; anoutput device; and a storage device to store instructions that areexecutable by the processor to perform the frame-to-frame digital videoencoding, comprising: partitioning a current frame into non-overlappingmacroblocks; computing a motion estimation termination threshold for acurrent macroblock using macroblock parameters; selecting an initialmotion vector for the current macroblock using spatio-temporalneighboring macroblock parameters; determining an initial distortion forthe current macroblock by computing a sum of absolute difference usingthe selected initial motion vector and the associated referencemacroblocks; comparing the computed initial distortion to the computedmotion estimation termination threshold; and encoding the currentmacroblock based on the outcome of the comparison.
 2. The system ofclaim 1, wherein encoding the current macroblock based on the outcome ofthe comparison, comprises: if the computed initial distortion is lessthan the computed motion estimation termination threshold, thenselecting the inter coding mode for encoding the current macroblock andchoosing the selected initial motion vector as the representative motionvector for the current macroblock; if the computed initial distortion isgreater than or equal to the computed motion estimation terminationthreshold, then computing the sum of absolute difference values at eachof the equidistant motion vector positions from the initial motionvector; determining a minimum sum of absolute difference value from thecomputed sum of absolute difference values; and comparing the determinedminimum sum of absolute difference value to the motion estimationtermination threshold and encoding the current macroblock based on theoutcome of the comparison.
 3. The system of claim 2, wherein comparingthe determined minimum sum of absolute difference value to the motionestimation termination threshold further comprises: if the determinedminimum sum of absolute difference value is less than the motionestimation termination threshold, then selecting the inter coding modefor encoding the current macroblock and choosing the motion vectorassociated with the minimum sum of absolute difference as therepresentative motion vector; if the determined minimum sum of absolutedifference value is greater than or equal to the motion estimationtermination threshold, then repeating the above steps for apredetermined number of times using the motion vector associated withthe minimum sum of absolute difference as the initial motion vector; ifafter repeating the above steps for the predetermined number of times,the determined minimum sum of absolute difference value does not yield avalue less than the motion estimation termination threshold, then doinga global full search to determine the motion vector based on the lowestsum of absolute difference value obtained; computing a block variance ofthe current macroblock and a block variance of the differencemacroblock; comparing the computed variance of the current macroblockvalue with the variance of the difference macroblock value; andselecting inter or intra coding for encoding the current macroblock andchoosing the motion vector associated with the minimum sum of absolutedifference from full search as the representative motion vector based onthe outcome of the comparison.
 4. The system of claim 3, whereincomputing an initial motion vector for the current macroblock usingspatio-temporal neighboring macroblock parameters further comprises:adopting a predefined voting technique to select the initial motionvector from spatio-temporal neighboring macroblock's motion vectors. 5.The system of claim 3, wherein computing the motion estimationtermination threshold for the current macroblock in a current frameusing macroblock parameters comprises: computing the motion estimationtermination threshold for the current macroblock using the equation:${sqrt}\left( {{\sum\limits_{I = 0}^{255}\left( {x_{I} - \mu} \right)^{2}} + {2*255*128*\left( x_{avg} \right)^{2}}} \right)$wherein x_(I)'s are luminance components of the current macroblock,x_(avg) is the allowed average absolute pixel-difference for an optimalprediction, and μ is the mean of x_(I) where I=0 to
 255. 6. The systemof claim 3, wherein computing the sum of absolute difference between thecurrent and reference macroblocks is based on using the equation:$\sum\limits_{I = 0}^{255}{{x_{I} - y_{I}}}$ wherein x_(I)'s areluminance components of the current macroblock and y_(I)'s are luminancecomponents of the reference macroblock.
 7. The system of claim 3,wherein comparing the block variance of current macroblock with theblock variance of difference macroblock is based on using the equations:${\sum\limits_{I = 0}^{255}\left( {x_{I} - y_{I}} \right)^{2}} < {\sum\limits_{I = 0}^{255}{\left( {x_{I} - \mu} \right)^{2}.}}$